export class MyEvent {
    public static MOVEMENT: string = 'MyEvent.MOVEMENT';
    public static MOVEMENT_STOP: string = 'MyEvent.MOVEMENT_STOP';
    public static SET_ATTACK_DIR: string = 'MyEvent.SET_ATTACK_DIR';
    public static Fire: string = 'MyEvent.Fire';
    public static Stop_Fire: string = 'MyEvent.Stop_Fire';
    public static ShowTakeSupplies: string = 'MyEvent.ShowTakeSupplies';
    public static ShowTakeItem: string = 'MyEvent.ShowTakeItem';
    public static Evacuation: string = 'MyEvent.Evacuation';//撤离

    public static RefreshMoney: string = 'MyEvent.REFRESH_MONEY';
    public static REFRESH_ITEMS: string = 'MyEvent.REFRESH_ITEMS';
    public static RefreshInventoryButtons: string = 'MyEvent.REFRESH_INVENTORYITEMS';
    public static RefreshGoodsItem: string = 'MyEvent.REFRESH_GOODSITEMS';
    public static RefreshBackpackGoodsItem: string = 'MyEvent.RefreshPlayerGoodsItem';
    public static RefreshEquip: string = 'MyEvent.RefreshEquip';
    public static RefreshBulletCount: string = 'MyEvent.RefreshBulletCount';
    public static LEVEL_LOAD_DONE: string = 'MyEvent.LEVEL_LOAD_DONE';

    public static CameraZoomIn: string = 'MyEvent.CameraZoomIn';
    public static CameraZoomOut: string = 'MyEvent.CameraZoomOut';
}

export class EventManager {
    public static get Scene() {
        return cc.director.getScene();
    }

    public static on(type: string, callback: Function, target?: any) {
        cc.director.getScene().on(type, callback, target);
    }

    public static off(type: string, callback?: Function, target?: any) {
        cc.director.getScene()?.off(type, callback, target);
    }
}